﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">

    <title>Preclinic - Medical & Hospital - Bootstrap 4 Admin Template</title>
    <link rel="stylesheet" type="text/css" href="../static/assets/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../static/assets/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../static/assets/css/select2.min.css">
    <link rel="stylesheet" type="text/css" href="../static/assets/css/dataTables.bootstrap4.min.css">
    <link rel="stylesheet" type="text/css" href="../static/assets/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" type="text/css" href="../static/assets/css/style.css">
    <!--[if lt IE 9]>
    <script src="../static/assets/js/html5shiv.min.js"></script>
    <script src="../static/assets/js/respond.min.js"></script>
    <![endif]-->
    <script src="../static/assets/js/jquery-3.2.1.min.js"></script>

</head>

<body>

<div class="main-wrapper">
    <div class="header">
        <div class="header-left">
            <a href="home" class="logo">
                <img src="../static/assets/img/logo.png" width="35" height="35" alt=""> <span>住院</span>
            </a>
        </div>
        <a id="toggle_btn" href="javascript:void(0);"><i class="fa fa-bars"></i></a>
        <a id="mobile_btn" class="mobile_btn float-left" href="#sidebar"><i class="fa fa-bars"></i></a>
        <ul class="nav user-menu float-right">
            <li class="nav-item dropdown d-none d-sm-block">
                <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown"><i class="fa fa-bell-o"></i> <span
                        class="badge badge-pill bg-danger float-right">  </span></a>
                <div class="dropdown-menu notifications">
                    <div class="topnav-dropdown-header">
                        <span>Notifications</span>
                    </div>
                    <div class="drop-scroll">
                        <ul class="notification-list">
                            <li class="notification-message">
                                <a href="activities.html">
                                    <div class="media">
											<span class="avatar">
												<img alt="John Doe" src="../static/assets/img/user.jpg"
                                                     class="img-fluid">
											</span>
                                        <div class="media-body">
                                            <p class="noti-details"><span class="noti-title">John Doe</span> added new
                                                task <span class="noti-title">Patient appointment booking</span></p>
                                            <p class="noti-time"><span class="notification-time">4 mins ago</span></p>
                                        </div>
                                    </div>
                                </a>
                            </li>
                            <li class="notification-message">
                                <a href="activities.html">
                                    <div class="media">
                                        <span class="avatar">V</span>
                                        <div class="media-body">
                                            <p class="noti-details"><span class="noti-title">Tarah Shropshire</span>
                                                changed the task name <span class="noti-title">Appointment booking with payment gateway</span>
                                            </p>
                                            <p class="noti-time"><span class="notification-time">6 mins ago</span></p>
                                        </div>
                                    </div>
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="topnav-dropdown-footer">
                        <a href="activities.html">View all Notifications</a>
                    </div>
                </div>
            </li>
            <li class="nav-item dropdown d-none d-sm-block">
                <a href="javascript:void(0);" id="open_msg_box" class="hasnotifications nav-link"><i
                        class="fa fa-comment-o"></i> <span class="badge badge-pill bg-danger float-right">  </span></a>
            </li>
            <li class="nav-item dropdown has-arrow">
                <a href="#" class="dropdown-toggle nav-link user-link" data-toggle="dropdown">
                        <span class="user-img">
							<img class="rounded-circle" src="../static/assets/img/user.jpg" width="24" alt="Admin">
							<span class="status online"></span>
						</span>
                    <span>用户</span>
                </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="#">设置</a>
                    <a class="dropdown-item" href="/loginout">退出登录</a>
                </div>
            </li>
        </ul>
        <div class="dropdown mobile-user-menu float-right">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i
                    class="fa fa-ellipsis-v"></i></a>
            <div class="dropdown-menu dropdown-menu-right">
                <a class="dropdown-item" href="profile.html">My Profile</a>
                <a class="dropdown-item" href="edit-profile.html">Edit Profile</a>
                <a class="dropdown-item" href="settings.html">Settings</a>
                <a class="dropdown-item" href="login.html">Logout</a>
            </div>
        </div>
    </div>
    <div class="sidebar" id="sidebar">

        <div class="sidebar-inner slimscroll">
            <div id="sidebar-menu" class="sidebar-menu">
                <ul>
                    <li>
                        <a href="index"><i class="fa fa-user"></i> <span> 患者信息 </span></span></a>
                    </li>
                    <li>
                        <a href="#"><i class="fa fa-edit"></i> <span> 申请单</span> <span class="menu-arrow"></span></a>
                        <ul style="display: none;">
                            <li><a href="drugApply">药品申请</a></li>
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;" id="chatBtn"><i class="fa fa-comments"></i> <span>聊天</span></a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="page-wrapper" id="allContentDiv">
        <div class="content">
            <div class="row">
                <div class="col-sm-4"></div>
                <div class="col-sm-4 col-3">
                    <h4 class="page-title">住院患者队列</h4>
                    <!--                    <p th:text="'获取到的信息' + ${hospitalizationInfos}">ghvdsaivlkndsavsdaljkv</p>-->
                </div>
                <!--                <div class="col-sm-8 col-9 text-right m-b-20">-->
                <!--                    <a href="add-patient" class="btn btn btn-primary btn-rounded"><i-->
                <!--                            class="fa fa-plus"></i> 下一位</a>-->
                <!--                </div>-->
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="table-responsive">
                        <!--                        <table class="table table-border table-striped custom-table datatable mb-0">-->
                        <table class="table table-border table-striped custom-table datatable mb-0">
                            <thead>
                            <tr>
                                <th>患者姓名</th>
                                <th>就诊科室</th>
                                <th>住院时间</th>
                                <th class="text-right">操作</th>
                            </tr>
                            </thead>
                            <tbody id="patient-list">
                            <tr th:each="h : ${hospitalizationInfos}">
                                <td th:text="${h.patient_name}"></td>
                                <td th:text="${h.section_name}"></td>
                                <td th:text="${h.hospitalization_time}"></td>
                                <td class="text-right">
                                    <span class="custom-badge status-green">
<!--                                        <a th:href="@{/drugApply/{medical_id}(medical_id=${h.medical_id})}">开药</a>-->
                                        <a th:href="@{'drugApply?medicalId=' + ${h.medical_id} + '&patientName=' + ${h.patient_name}}">开药</a>
                                    </span>
                                </td>
                            </tr>
                            <!--                            <tr>-->
                            <!--                                <td><img width="28" height="28" src="../static/assets/img/user.jpg" class="rounded-circle m-r-5"-->
                            <!--                                         alt=""> 小明-->
                            <!--                                </td>-->
                            <!--                                <td>35</td>-->
                            <!--                                <td>重庆渝北</td>-->
                            <!--                                <td>15326534256</td>-->
                            <!--                                <td><a href="http://cdn-cgi/l/email-protection" class="__cf_email__"-->
                            <!--                                       data-cfemail="86ece3e8e8efe0e3f4f4e9e4efe8f5e9e8c6e3fee7ebf6eae3a8e5e9eb">123@163.com</a>-->
                            <!--                                </td>-->
                            <!--                                <td class="text-right">-->
                            <!--                                    <select class="select">-->
                            <!--                                        <option>等待就诊</option>-->
                            <!--                                        <option value="1">就诊中</option>-->
                            <!--                                        <option value="2">推迟就诊</option>-->
                            <!--                                        <option value="3">诊断完成</option>-->
                            <!--                                    </select>-->
                            <!--                                </td>-->
                            <!--                            </tr>-->
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <div class="notification-box">
            <div class="msg-sidebar notifications msg-noti">
                <div class="topnav-dropdown-header">
                    <span>Messages</span>
                </div>
                <div class="drop-scroll msg-list-scroll" id="msg_list">
                    <ul class="list-box">
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">R</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author">Richard Miles </span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item new-message">
                                    <div class="list-left">
                                        <span class="avatar">J</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author">John Doe</span>
                                        <span class="message-time">1 Aug</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">T</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author"> Tarah Shropshire </span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">M</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author">Mike Litorus</span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">C</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author"> Catherine Manseau </span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">D</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author"> Domenic Houston </span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">B</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author"> Buster Wigton </span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">R</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author"> Rolland Webber </span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">C</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author"> Claire Mapes </span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">M</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author">Melita Faucher</span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">J</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author">Jeffery Lalor</span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">L</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author">Loren Gatlin</span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="chat.html">
                                <div class="list-item">
                                    <div class="list-left">
                                        <span class="avatar">T</span>
                                    </div>
                                    <div class="list-body">
                                        <span class="message-author">Tarah Shropshire</span>
                                        <span class="message-time">12:28 AM</span>
                                        <div class="clearfix"></div>
                                        <span class="message-content">Lorem ipsum dolor sit amet, consectetur adipiscing</span>
                                    </div>
                                </div>
                            </a>
                        </li>
                    </ul>
                </div>
                <div class="topnav-dropdown-footer">
                    <a href="chat.html">See all messages</a>
                </div>
            </div>
        </div>
    </div>
    <div class="page-wrapper" id="chatBox">
        <div class="chat-main-row">
            <div class="chat-main-wrapper">
                <div class="col-lg-9 message-view chat-view">
                    <div class="chat-window">
                        <div class="chat-contents">

                        </div>
                        <div class="chat-footer">
                            <div class="message-bar">
                                <div class="message-inner">
                                    <a class="link attach-icon" href="#" data-toggle="modal"
                                       data-target="#drag_files"><img src="../static/assets/img/attachment.png" alt=""></a>
                                    <div class="message-area">
                                        <div class="input-group">
                                            <textarea class="form-control" placeholder="Type message..."
                                                      v-model="inputContent"></textarea>
                                            <span class="input-group-append">
													<button class="btn btn-primary" type="button"
                                                            @click="sentInputMessage"><i
                                                            class="fa fa-send"></i></button>
												</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 message-view chat-profile-view chat-sidebar" id="chat_sidebar">
                    <div class="chat-window video-window">
                        <div class="tab-content chat-contents">
                            <div class="content-full tab-pane" id="calls_tab">
                                <div class="chat-wrap-inner">
                                    <div class="chat-box">
                                        <div class="chats">
                                            <div class="chat chat-left">
                                                <div class="chat-avatar">
                                                    <a href="profile.html" class="avatar">
                                                        <img alt="Cristina Groves"
                                                             src="../static/assets/img/doctor-thumb-03.jpg"
                                                             class="img-fluid rounded-circle">
                                                    </a>
                                                </div>
                                                <div class="chat-body">
                                                    <div class="chat-bubble">
                                                        <div class="chat-content">
                                                            <span class="chat-user">You</span> <span class="chat-time">8:35 am</span>
                                                            <div class="call-details">
                                                                <i class="material-icons">phone_missed</i>
                                                                <div class="call-info">
                                                                    <div class="call-user-details">
                                                                        <span class="call-description">Jeffrey Warden missed the call</span>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="chat chat-left">
                                                <div class="chat-avatar">
                                                    <a href="profile.html" class="avatar">
                                                        <img alt="Jennifer Robinson"
                                                             src="../static/assets/img/patient-thumb-02.jpg"
                                                             class="img-fluid rounded-circle">
                                                    </a>
                                                </div>
                                                <div class="chat-body">
                                                    <div class="chat-bubble">
                                                        <div class="chat-content">
                                                            <span class="chat-user">Jennifer Robinson</span> <span
                                                                class="chat-time">8:35 am</span>
                                                            <div class="call-details">
                                                                <i class="material-icons">call_end</i>
                                                                <div class="call-info">
                                                                    <div class="call-user-details"><span
                                                                            class="call-description">This call has ended</span>
                                                                    </div>
                                                                    <div class="call-timing">Duration: <strong>5 min 57
                                                                        sec</strong></div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="chat-line">
                                                <span class="chat-date">January 29th, 2015</span>
                                            </div>
                                            <div class="chat chat-left">
                                                <div class="chat-avatar">
                                                    <a href="profile.html" class="avatar">
                                                        <img alt="Cristina Groves"
                                                             src="../static/assets/img/doctor-thumb-03.jpg"
                                                             class="img-fluid rounded-circle">
                                                    </a>
                                                </div>
                                                <div class="chat-body">
                                                    <div class="chat-bubble">
                                                        <div class="chat-content">
                                                            <span class="chat-user">You</span> <span class="chat-time">8:35 am</span>
                                                            <div class="call-details">
                                                                <i class="material-icons">ring_volume</i>
                                                                <div class="call-info">
                                                                    <div class="call-user-details">
                                                                        <a href="#"
                                                                           class="call-description call-description--linked"
                                                                           data-qa="call_attachment_link">Calling
                                                                            Jennifer ...</a>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="content-full tab-pane show active" id="profile_tab">
                                <div class="display-table">
                                    <div class="table-row">
                                        <div class="table-body">
                                            <div class="table-content">
                                                <h3>选择聊天部门</h3>
                                                <div>
                                                    <input type='button' class='btn btn-primary' value="护士部"
                                                           @click="getCallAction(9004)"/>
                                                    <input type='button' class='btn btn-primary' value="财务部"
                                                           @click="getCallAction(9003)"/>
                                                    <input type='button' class='btn btn-primary' value="挂号部"
                                                           @click="getCallAction(9002)"/>
                                                    <input type='button' class='btn btn-primary' value="手术部"
                                                           @click="getCallAction(9001)"/>
                                                </div>
                                                <div style="margin-top: 10px">
                                                    <input type='button' class='btn btn-primary' value="门诊部"
                                                           @click="getCallAction(9005)"/>
                                                </div>
                                                <div style="margin-top: 510px">
                                                    <input type='button' class='btn btn-primary closeCallBox'
                                                           value="关闭聊天"/>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="delete_patient" class="modal fade delete-modal" role="dialog">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-body text-center">
                    <img src="../static/assets/img/sent.png" alt="" width="50" height="46">
                    <h3>Are you sure want to delete this Patient?</h3>
                    <div class="m-t-20"><a href="#" class="btn btn-white" data-dismiss="modal">Close</a>
                        <button type="submit" class="btn btn-danger">Delete</button>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<div class="sidebar-overlay" data-reff=""></div>

<script src="../static/assets/js/popper.min.js"></script>
<script src="../static/assets/js/bootstrap.min.js"></script>
<script src="../static/assets/js/jquery.slimscroll.js"></script>
<script src="../static/assets/js/select2.min.js"></script>
<script src="../static/assets/js/jquery.dataTables.min.js"></script>
<script src="../static/assets/js/dataTables.bootstrap4.min.js"></script>
<script src="../static/assets/js/moment.min.js"></script>
<script src="../static/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="../static/assets/js/app.js"></script>
<script src="../static/vue.js"></script>
<script>
    $("#chatBox").hide();

    //这是打开聊天窗口的方法
    $("#chatBtn").click(function () {
        $("#allContentDiv").hide(200);
        $("#chatBox").show(200);
    });
    //这是关闭聊天窗口的方法
    $(".closeCallBox").click(function () {
        $("#allContentDiv").show(200);
        $("#chatBox").hide(200);
    });

    //这是页面通信的vue
    var app = new Vue({
        el: ".main-wrapper",
        created() { // 页面创建生命周期函数
            this.initWebSocket();
        },
        destroyed: function () { // 离开页面生命周期函数
            this.websocketclose();
        },
        data: {
            callAction: "",
            inputContent: ""
        },
        methods: {
            initWebSocket: function () {
                // WebSocket与普通的请求所用协议有所不同，ws等同于http，wss等同于https
                this.websock = new WebSocket("ws://localhost:8080/websocket/{9006}");
                this.websock.onopen = this.websocketonopen;
                this.websock.onerror = this.websocketonerror;
                this.websock.onmessage = this.websocketonmessage;
                this.websock.onclose = this.websocketclose;
            },
            websocketonopen: function () {
                console.log("WebSocket连接成功");
            },
            websocketonerror: function (e) {
                console.log("WebSocket连接发生错误");
            },
            websocketonmessage: function (e) {
                var showInfo = $("<h1>").text(e.data);
                $(".chat-contents").append(showInfo);
                $("#allContentDiv").hide(200);
                $("#chatBox").show(200);
            },
            websocketclose: function (e) {
                console.log("connection closed (" + e.code + ")");
            },
            sendInfo: function (shipId, message) {
                // 这里只是一个基于axios的ajax请求，你可以换成你的请求格式
                $.ajax({
                    type: "post",
                    url: "test",
                    data: {"shipId": shipId, "message": message},
                    async: true,
                    success: function () {
                    }
                });
            },
            getCallAction: function (e) {
                console.log(e);
                this.callAction = e;
            },
            sentInputMessage: function () {
                var messageContent = this.inputContent;
                var calltarget = this.callAction;
                if (calltarget.length < 1) {
                    layer.alert("请选者部门", {icon: 5});
                } else if (messageContent.length < 1) {
                    layer.alert("请输入消息", {icon: 5});
                } else {
                    messageContent = "来自住院部的消息-->" + messageContent;
                    this.sendInfo(calltarget, messageContent);
                    this.inputContent = "";
                }
            }
        }
    });
</script>


</body>

</html>